home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11954 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  856 b 

  1. Path: leeds.ac.uk!news
  2. Newsgroups: comp.lang.c
  3. Subject: HELP - malloc
  4. Message-ID: <1996Mar27.143834.6017@leeds.ac.uk>
  5. From: csyamc@scs.leeds.ac.uk (A M Casey)
  6. Date: Wed, 27 Mar 1996 14:38:33 +0000 (GMT)
  7. Organization: The University of Leeds, School of Computer Studies
  8. NNTP-Posting-Host: csgi08.leeds.ac.uk
  9.  
  10. I pass this character string into a function, defined as
  11.  
  12. ItemName *char
  13.  
  14. and I have already allocated memory (ItemName=malloc(50)) and
  15. set it to a value. It gets into the function fine, but when I call
  16. another function, passing ItemName to it, the function changes it
  17. to become nothing, although I dont see why. The function which is
  18. called does use malloc to allocate memory for other strings, but shouldnt
  19. change ItemName in any way.
  20.  
  21. Has malloc overwritten my previously defined string or something?
  22.  
  23.  
  24. PLEASE PLEASE PLEASE help
  25.  
  26. cheers
  27.  
  28. Andy
  29.  
  30.  
  31.